import java.lang.reflect.Array;
import java.util.Arrays;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User:22954
 * Date:2024-01-02
 * Time:23:00
 */
public class Test {
    public static void main(String[] args) {
        int[]arr1={1,2,4,5,6,8};
        int[]arr2=new int[arr1.length];
        for (int i = 0; i < arr2.length; i++) {
            arr2[i]=arr1[i];
        }
        System.out.println(Arrays.toString(arr1));
        System.out.println(Arrays.toString(arr2));
    }
    public static void main6(String[] args) {
        int [] ret=fuc1();
        System.out.println(Arrays.toString(ret));
    }
    public static int[] fuc1(){
        int []tmp={1,2,3,4};
        return tmp;
    }
    public static void main5(String[] args) {
        int[] array={1,2,3};
        System.out.println(array);
        int[] array2=array;
        array2[1]=99;
        System.out.println(Arrays.toString(array));
        System.out.println(Arrays.toString(array2));
    }
    public static void main4(String[] args) {
        int[] array={0,1,2,3,4,5,6,7,8,9};
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i]+" ");
        }
        System.out.println();
        for(int x:array){
            System.out.print(x+" ");
        }
        System.out.println();
        String ret=Arrays.toString(array);
        System.out.println(ret);
    }
    public static void main3(String[] args) {
        int a=5;
        char[] chars=new char[10];
        int[] array=new int[a];
    }
    public static void main2(String[] args) {
        System.out.println(fac(5));
        print(12345);
        System.out.println(sum(5));
        System.out.println(fib(7));
//        System.out.println(sum(1393));
    }

    public static int fib(int n){
        if(n==1||n==2){
            return 1;
        }
        return fib(n-1)+fib(n-2);
    }

    public static int sum(int n) {
        if(n==1){
            return n;
        }
        return n+sum(n-1);
    }
/*    public static int sum(int n){
        if(n<10){
            return n;
        }
        return n%10+sum(n/10);
    }*/

    public static void print(int n) {
        if (n < 10) {
            System.out.println(n);
        } else {
            print(n / 10);
            System.out.println(n%10);
        }
    }

    public static long fac(int n) {
        if (n == 1) {
            return 1;
        }
        return n * fac(n - 1);
    }

    public static void main1(String[] args) {
        facsum(4);
    }

    public static void facsum(int n) {
        long sum = 0;
        for (int i = 1; i <= n; i++) {
            sum += fac(i);
        }
        System.out.println(sum);
    }
/*    public static long fac(int n){
        long ret=1;
        for (int i = 1; i <=n ; i++) {
            ret*=i;
        }
        return ret;
    }*/
}
